//
//  TitleButton.swift
//  DSWeibo
//
//  Created by J on 16/2/22.
//  Copyright © 2016年 J. All rights reserved.
//

import UIKit

class TitleButton: UIButton {

    
  override  init(frame: CGRect) {
        super.init(frame: frame)
    setTitle("大神微博", forState: UIControlState.Normal)
    sizeToFit()
    setTitleColor(UIColor.darkGrayColor(), forState: UIControlState.Normal)
    setImage(UIImage(named: "navigationbar_arrow_down"), forState: UIControlState.Normal)
    setImage(UIImage(named: "navigationbar_arrow_up"),   forState: UIControlState.Selected)

    
    }

  required init?(coder aDecoder: NSCoder) {
      fatalError("init(coder:) has not been implemented")
  }
    override func layoutSubviews() {
        super.layoutSubviews()
        
        //可以直接访问对象的结构体成员进行修改
        titleLabel?.frame.origin.x = 0;
        imageView?.frame.origin.x = titleLabel!.frame.size.width + CGFloat(5)//加一个间距
        
 
    }
    
    
}
